package com.xiaochong.tir.trades.scheduled;

import com.xc.logclient.utils.LogTrace;
import com.xiaochong.tir.trades.component.CnyToUsdRateComponent;
import com.xiaochong.tir.trades.config.ExecutorConfig;

import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;


/**
 * Created by org on 2018/6/02.
 * 定时查询人民币和美元汇率，保存redis中
 */
@Component
public class RmbUsdExchangeRateScheduled {

    @Resource
    private CnyToUsdRateComponent cnyToUsdRateComponent;

    @Async(ExecutorConfig.SCHEDULER_EXECUTOR_POOL)
    @Scheduled(cron="0 0 0/1 * * ?")
    public void changeRate() {
    	LogTrace.beginTrace("去接口获取汇率保存到redis中");
        //去接口获取汇率保存到redis中
        cnyToUsdRateComponent.getCnyUsdRate();
    }


}
